cmake_minimum_required(VERSION 3.4.1)
project(test)

set(CMAKE_CXX_STANDARD 14)
set(LIBRARY_OUTPUT_PATH  ${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_CXX_FLAGS -Wall)
set(CMAKE_EXE_LINKER_FLAGS -lrt)
set(CMAKE_BUILD_TYPE "Debug")
SET (CMAKE_VERBOSE_MAKEFILE 1) #查看详细编译信息
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/modules)
set (GLIBCXX_USE_CXX11_ABI 1)
add_definitions(-D _GLIBCXX_USE_CXX11_ABI=1)

find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED system regex)
find_package(LuaGoogle REQUIRED)

file(GLOB_RECURSE ALL_SRCS "*.cpp" "*.h")
file(GLOB_RECURSE ALL_EXECUTABLES "*_main.cpp")

set(LUA_FILE_DIRECTORY ${PROJECT_SOURCE_DIR}/configuration_files
  CACHE PATH ".lua configuration files directory")

list(REMOVE_ITEM ALL_SRCS ${ALL_EXECUTABLES})
add_library(${PROJECT_NAME} ${ALL_SRCS})

add_subdirectory(main)

# Eigen3
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
  "${EIGEN3_INCLUDE_DIR}")

#rt
target_link_libraries(${PROJECT_NAME} PUBLIC rt) #添加rt库支持，使用shm_open

#pthread
target_link_libraries(${PROJECT_NAME} PUBLIC pthread)
# Boost
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
"${Boost_INCLUDE_DIRS}")
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES})

target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
  "${LUA_INCLUDE_DIR}")
target_link_libraries(${PROJECT_NAME} PUBLIC ${LUA_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PUBLIC glog)


target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)